import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

public class TcpDictServer extends TcpEchoServer {
    private Map<String,String> dict = new HashMap<>();
    public TcpDictServer(int port) throws IOException {
        super(port);
        dict.put("dog","小狗");
        dict.put("cat","小猫");
        dict.put("pig","小猪");
    }
    public String process(String request) {
        return dict.getOrDefault(request,"改词在词典中找不到");
    }

    public static void main(String[] args) throws IOException {
        TcpDictServer tcpDictServer = new TcpDictServer(9090);
        tcpDictServer.start();
    }
}